<template>
  <div class="app-container">
    <el-table
      height="calc(100vh - 200px)"
      :data="tableData.list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column align="center" label="ID" width="95">
        <template slot-scope="scope">
          {{ scope.$index+1 }}
        </template>
      </el-table-column>
      <el-table-column label="名称">
        <template slot-scope="scope">
          {{ scope.row.title }}
        </template>
      </el-table-column>

      <el-table-column label="内容">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>

      <el-table-column label="简介">
        <template slot-scope="scope">
          {{ scope.row.introduction }}
        </template>
      </el-table-column>

      <el-table-column label="任务奖励">
        <template slot-scope="scope">
          {{ scope.row.rewardProps }}
        </template>
      </el-table-column>

      <el-table-column label="完成方式">
        <template slot-scope="scope">
          {{ ['AR','小游戏'][scope.row.finishMode] }}
        </template>
      </el-table-column>

      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-link type="primary">修 改</el-link>
          /
          <el-link type="primary">删除</el-link>
        </template>
      </el-table-column>

    </el-table>
    <div style="margin-top: 30px" />

  </div>
</template>

<script>
import taskApi from '@/api/taskApi'
export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'gray',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    return {
      tableData: {
        list: [

        ],
        current: 0

      },
      list: null
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.listLoading = true
      taskApi.geziRenWuByFuId(this.$route.query.fuRenWuId).then(response => {
        return response.data.list
      }).then(list => {
        this.tableData.list = list
      })
    }
  }
}
</script>
